package com.itheima.pojo;

import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Past;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Student {
    private Integer id; //ID
    @NotBlank(message = "姓名不能为空")
    @Size(min = 2,max = 10,message = "姓名长度在2-10之间")
    private String name; //姓名
    @NotBlank(message = "学号不能为空")
    @Size(min = 6,max = 12,message = "学号长度在6-12之间")
    private String no; //序号
    @NotNull(message = "性别不能为空")
    private Integer gender; //性别 , 1: 男 , 2 : 女
    @NotNull(message = "手机号不能为空")
    //^开始 $结束 []枚举, \d数字， {数量}  {3,9} =>最少3位，最多9位
    @Pattern(regexp = "^1[3-9]\\d{9}$",message = "手机号格式不正确")
    //@Length(min = 11,max = 11,message = "手机号长度为11")
    private String phone; //手机号
    @NotNull(message = "身份证号不能为空")
    @Pattern(regexp = "^\\d{17}[0-9X]$",message = "身份证为18位数字")
    private String idCard; //身份证号
    @NotNull(message = "是否来自院校不能为空")
    private Integer isCollege; //是否来自于院校, 1: 是, 0: 否
    @Length(max = 100,message = "联系地址最多100个字符")
    private String address; //联系地址
    @Min(value = 1,message = "学历不能为空")
    @Max(value = 6,message = "学历不能超过博士")
    private Integer degree; //最高学历, 1: 初中, 2: 高中 , 3: 大专 , 4: 本科 , 5: 硕士 , 6: 博士
    @Past(message = "毕业时间必须为过去时间")
    private LocalDate graduationDate; //毕业时间
    @NotNull(message = "班级不能为空")
    private Integer clazzId; //班级ID
    private Short violationCount; //违纪次数
    private Short violationScore; //违纪扣分
    private LocalDateTime createTime; //创建时间
    private LocalDateTime updateTime; //修改时间

    private String clazzName;//班级名称
}